<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }

    :root,
    body {
      width: 100%;
      height: 100%;
    }

    #app {
      width: 100%;
      height: 100%;
    }
  </style>
</head>

<body>
  <!-- 
    全局按键修饰符
      Vue.config.keyCodes.f1=112
        112:代表的按钮的唯一标识,通过事件对象可以获取到这个值

      <input type="text" @keyup.65="handle" v-model="info">
        当按了“a”就触发事件,“a”的按键值是65

    按键修饰符的规则:名字是自定义的，但是对应的值必须是按键对应的event.keyCode值
  -->
  <div id="app" @keyup="aa">
    <input type="text" @keyup="handle" v-model="info">
  </div>
  <script src="../js/vue.js"></script>
  <script>
    const mv = new Vue({
      el: "#app",
      data: {
        info: ""
      },
      methods: {
        handle(event) { //获取键盘上按钮的事件对象
          console.log(event.keyCode); //获取按键值
        },
        aa() {
          console.log(`好你个了吧`);
        }
      }
    });

  </script>
</body>

</html>